package org.dubbo.controller;

import org.apache.dubbo.config.annotation.Reference;
import org.dubbo.bean.UserVo;
import org.dubbo.response.ApiResp;
import org.dubbo.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class UserController {

    @Reference
    private UserService userService;
    
    @RequestMapping("register")
    public ApiResp register(UserVo user) {
        userService.register(user);
        return ApiResp.success();
    }
    
    @GetMapping("user/get")
    public ApiResp getUser(Integer id) {
        return ApiResp.success(userService.getUserById(id));
    }
}
